let item1 = (location.search).substring(1)   //截取，第一个参数是从下面多少开始，第二个参数是到下面多少截至
let param1 = item.split('=')[1]
console.log(item1);
console.log(param1);



const xhr1 = new XMLHttpRequest();

// xhr.open("get",`http://chst.vip:1234/api/getmoneyctrlproduct?productid=${param}`);

xhr1.open("get",`http://chst.vip:1234/api/getdiscountproduct?productid=${param1}`);
xhr1.send(null);

xhr1.onreadystatechange = function(){
    let oul = document.querySelector("ul");
    if(xhr1.readyState === 4){
        if(xhr1.status === 200){
            let res = JSON.parse(xhr1.responseText);
            console.log(res)

            // let regExp = /(?<=imgurl=)[^'"]*/;
            let ele = "";
            res.result.forEach(item => {
                // console.log(item);
                var img = item.productImg;
                ele += `<li>
                            <h4>${item.productName}</h4>
                            <span>${item.productFrom} | ${item.productTime} &nbsp ${item.productTips}</span>
                            <i>${item.productPrice}</i>
                            <p>${item.productInfo}</p>
                            ${img}
                        </li>`
                
                // `<div productId="${item.productId}">
                //         <img src="${img}" alt="">
                //         <h5>${item.productName}</h5>
                //         <p>${item.productPinkage}</p>
                //         <span>${item.productTime}</span>
                //     </div>`

            });
            oul.innerHTML = ele;
        }
    }
}